package com.uplift.common.utils;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLConnection;

import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.ObjectMapper;

public class WebMessage {

    private static ObjectMapper om = new ObjectMapper();

    public static void sendJsonMessageIgnoreEx(HttpServletResponse response, Object obj) {
        response.setContentType("text/html; charset=utf-8");
        try {
            PrintWriter writer = response.getWriter();
            writer.println(om.writeValueAsString(obj));
            writer.close();
            response.flushBuffer();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
